//
//  RedBagModels.swift
//  LeGou
//
//  Created by lxm on 2022/10/8.
//

import Foundation
struct RedBagModels {
    class Rank : HandyJSON {
        required init(){}
        var amount = 0.0
        var lvl: Int = 0
        var nickname = ""
        var phone = ""
        var uid: Int = 0
    }
    
    class RedActivityData : HandyJSON {
        required init(){}
        var next : RedActivityInfo?
        var now : RedActivityInfo?
        var wait : RedActivityInfo?
        var serverTime = ""
        
        func getIds() -> [Int] {
            var r = [Int]()
            if let now = now {
                r.append(now.id)
            }
            if let wait = wait {
                r.append(wait.id)
            }
            if let next = next {
                r.append(next.id)
            }
            return r
        }
    }
    
    class RedActivityInfo : HandyJSON {
        required init(){}
        var endTime = ""
        var id = 0
        var realEndTime = ""
        var realStartTime = ""
        var startTime = ""
        
        var realEndTimeDate : Date? {
            get {
                return realEndTime.zm.toDate(formate: "yyyy-MM-dd HH:mm:ss")
            }
        }
        
        var realStartTimeDate : Date? {
            get {
                return realStartTime.zm.toDate(formate: "yyyy-MM-dd HH:mm:ss")
            }
        }
        
        var startTimeDate : Date? {
            get {
                return startTime.zm.toDate(formate: "yyyy-MM-dd HH:mm:ss")
            }
        }
    }
    
    class RedRobResult : HandyJSON {
        required init(){}
        var amount = 0.0
        var bagId = 0
        // 红包抢的结果0 = 成功 1 = 抢完 2 = 抢过
        var state = 0
        // 红包类型1 = 普通红包 2 = 幸运红包
        var type = 0
    }    
}

